package com.sz.framework.threadlocal;

/**
 * 默认线程隔离对象实现
 *
 * @author: yxl
 * 2025-07-24
 */
public class SzDefaultThreadLocal<T> implements SzThreadLocal<T> {

    private ThreadLocal<T> threadLocal;

    public SzDefaultThreadLocal(ThreadLocal<T> threadLocal){
        this.threadLocal = threadLocal;
    }

    @Override
    public Object getSource() {
        return threadLocal;
    }

    @Override
    public void set(T value) {
        threadLocal.set(value);
    }

    @Override
    public T get() {
        return threadLocal.get();
    }

    @Override
    public void clear() {
        threadLocal.remove();
    }
}
